<?php

/**
 * Personne form.
 *
 * @package    TC5
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $
 */
class PersonneForm extends BasePersonneForm
{
  public function configure()
  {
	  $this->setWidgets(array(
	      'id'            => new sfWidgetFormInputHidden(),
	      'nom'           => new sfWidgetFormInput(),
	      'prenom'        => new sfWidgetFormInput(),
	      'pseudo'        => new sfWidgetFormInput(),
	      'email'         => new sfWidgetFormInput(),
	      'password'      => new sfWidgetFormInput(),
	      'adresse'       => new sfWidgetFormTextarea(),
	      'code_postal'   => new sfWidgetFormInput(),
	      'ville'         => new sfWidgetFormInput(),
	    ));
	
	    $this->setValidators(array(
	      'id'            => new sfValidatorPropelChoice(array('model' => 'Personne', 'column' => 'id', 'required' => false)),
	      'nom'           => new sfValidatorString(array('max_length' => 255, 'required' => true)),
	      'prenom'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
	      'pseudo'        => new sfValidatorString(array('max_length' => 255, 'required' => true)),
	      'email'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
	      'password'      => new sfValidatorString(array('max_length' => 255, 'required' => true)),
	      'adresse'       => new sfValidatorString(array('required' => true)),
	      'code_postal'   => new sfValidatorString(array('max_length' => 10, 'required' => true)),
	      'ville'         => new sfValidatorString(array('max_length' => 1000, 'required' => true)),
	    ));
	
	    $this->widgetSchema->setNameFormat('personne[%s]');
	
	    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
  }
}
